package com.pattern.once.templates;

import java.util.ArrayList;
import java.util.List;

public abstract class Car {

    private List<String> list = new ArrayList<String>();

    protected abstract void start();
    protected abstract void mingdi();
    protected abstract void shache();
    protected abstract void stop();

    public void run(){

        list.stream().forEach(o->{
            if (o.equals("start")){
                this.start();
            }else if (o.equals("mingdi")){
                this.mingdi();
            }else if (o.equals("shache")){
                this.shache();
            }else if (o.equals("stop")){
                this.stop();
            }
        });
    };

    public List<String> getList() {
        return list;
    }

    public void setList(List<String> list) {
        this.list = list;
    }
}
